<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 500px;
            height: 500px;
            background-color: #ff0;
            overflow: hidden;
            margin: 100px;
            position: relative;
        }
        .a {
            width: 200px;
            height: 200px;
            padding: 10px;
            margin: 50px;
            border: 20px solid #000;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="a"></div>
    </div>

    <script>

        var oDiv = document.querySelector('.a') ;

        console.log(getComputedStyle(oDiv)['height']);   // css写的宽高  带有px

        console.log(oDiv.clientHeight);   // 包含内边距的宽高

        console.log(oDiv.offsetHeight);   // 包含内边距和边框的宽高


        console.log(oDiv.offsetTop);  // 距离最近的具有定位的祖先元素的上边距/左边距

        console.log(oDiv.offsetLeft);

    </script>


</body>
</html>